<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Schools extends Model
{

    public function setBannersAttribute($banners)
    {
        if (is_array($banners)) {
            $this->attributes['banners'] = json_encode($banners);
        }
    }

    public function getBannersAttribute($banners)
    {
        return json_decode($banners, true);
    }

    // public function setBannersAttribute($banners)
    // {
    //     if (is_array($banners)) {
    //         $this->attributes['banners'] = implode(',',$banners);
    //     }
    // }

    // public function getBannersAttribute($banners)
    // {
    //     return explode(',',$banners);
    // }
}
